class Solution:
    def myAtoi(self, s: str):
        INT_MAX, INT_MIN = 2**31-1, -1*2**31
        sets = [str(i) for i in range(10)]
        sets += ['-', '.']
        ss = s.split()
        if len(ss) == 0:
            return 0
        s1 = ss[0]
        for a in s1:
            if a not in sets:
                return 0
        if s1 == '-':
            return 0
        num = eval(s1)
        if num > INT_MAX:
            return INT_MAX
        if num < INT_MIN:
            return INT_MIN
        return num
